package com.xdf.wxbebarrel.model;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.HashMap;
import java.util.Map;

@XStreamAlias("xml")
public class WechatTextMessage extends WechatBaseMassage {
    @XStreamAlias("Content")
    private String content;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "TextMessage [content=" + content + ", getToUserName()=" + getToUserName() + ", getFromUserName()="
                + getFromUserName() + ", getCreateTime()=" + getCreateTime() + ", getMsgType()=" + getMsgType() + "]";
    }

    /**
     * 构造方法，得到一个实例对象
     * @param reqMap = req.getInputStream()
     * @param content 显示给用户的文本
     */
    public WechatTextMessage(Map<String, String> reqMap, String content) {
        super(reqMap);
        this.setMsgType("text");
        this.content = content;
    }

    public WechatTextMessage get(String toOpenId,String content){
        Map<String,String> map = new HashMap<>();
        map.put("FromUserName","");
        map.put("ToUserName",toOpenId);

        return new WechatTextMessage(map,content);
    }

}
